import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

///上拉加载

class MyFooter extends StatelessWidget {
  const MyFooter({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomFooter(
      builder: (BuildContext context, LoadStatus mode) {
        Widget body;

        if(mode==LoadStatus.idle){
          body =  Text("上拉加载",style: TextStyle(fontSize: 14));
        }
        else if(mode==LoadStatus.loading){
          body =  CupertinoActivityIndicator();
        }
        else if(mode == LoadStatus.failed){
          body = Text("加载失败！点击重试！",style: TextStyle(fontSize: 14));
        }
        else if(mode == LoadStatus.canLoading){
          body = Text("松手,加载更多!",style: TextStyle(fontSize: 14));
        }
        else if(mode == LoadStatus.noMore){
          body = Text("没有更多数据了!",style: TextStyle(fontSize: 14),);
        }

        return Container(
          height: 55.0,
          child: Center(child: body),
        );
      },
    );
  }
}